<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/pages/common/taglib.jsp" %>
<div class="container-fluid am-margin-top">
    <form id="funcPointForm">
        <input type="hidden" name="id"/>
        <div class="form-group">
            <label for="name">功能点名称</label>
            <input type="text" name="name" class="form-control" check-type="required">
        </div>
        <div class="form-group">
            <label for="url">URL</label>
            <input type="text" name="url"  class="form-control" placeholder="url地址或js方法名" check-type="required">
        </div>
        <div class="form-group">
        	<a href="javascript:void(0)" id="funcPointFormSaveBt" class="btn btn-primary pull-right">保存</a>
    	</div>
    </form>
</div>
<script type="text/javascript">

    $(function () {
        var id = '${param.id}';
        $("#funcPointForm").validation();
        //初始化
        if (id) {
            $.getJSON(ctx + '/funcPointAction/getFuncPoint.do', {id: id}, function (data) {
                webUtils.fullForm({
                    form: $("#funcPointForm"),
                    data: data
                });
            });
        }
        //事件
        $("#funcPointFormSaveBt").click(function () {
        	if($("#funcPointForm").valid()){
        		$("#funcPointForm").ajaxSubmit({
                    url: ctx + '/funcPointAction/saveFuncPoint.do',
                    data: {},
                    type: "POST",
                    success: function (data) {
                        if (data.success) {
                            webUtils.alert("提交成功");
                            top.webUtils.topicPublish("funcPoint.edit.success", data);
                        } else {
                            webUtils.error("请选择需要编辑的数据");
                        }
                    }
                });
        	}
        });
    });
</script>